package com.frame.work.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * MyBatisPlus的一些基本配置
 *
 * @author wjming
 */
@Component
public class MyConfigHandler implements MetaObjectHandler {


    @Override
    public void insertFill(MetaObject metaObject) {
        //修改时间
        setFieldValByName("createTime", LocalDateTime.now(), metaObject);
//        setFieldValByName("modifyTime", LocalDateTime.now(), metaObject);
//        //修改者
//        setFieldValByName("modifyId", getControllerId(), metaObject);


    }

    @Override
    public void updateFill(MetaObject metaObject) {
        setFieldValByName("modifyTime", LocalDateTime.now(), metaObject);
    }
}

